// export const mobileReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; // /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
export const passWordReg = /^[a-zA-Z\d]{6,8}$/;

// 固话
export const landPhoneReg = new RegExp("^0\\d{2,3}-?(\\d{7,8}|\\d{5})$");
// 手机号
export const mobileReg = new RegExp("^(\\+)?(\\d{2,3})?0?1\\d{10}$");
export const mobileAndTel = new RegExp("(^0\\d{2,3}-?(\\d{7,8}|\\d{5})$)|(^(\\+)?(\\d{2,3})?0?1\\d{10}$)")
// 身份证
export const idCardReg = new RegExp(
    "(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$)"
);
// 车牌
// export const plateNumberReg = new RegExp(
//     "^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})$"
// );
export const plateNumberReg = new RegExp(
    "^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})$"
);
/* 密码 */
export const parsswordReg = /^.*(?=.{8,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘'，。、])(?!.*\s)(?!.*[\u4e00-\u9fa5]).*$/

export const parsswordAdded = ['123456','96533','ytk','unitoll']
// 银行卡
export const bankReg = /^[0-9]\d{4,31}$/;
/* 数字（包括小数） */
export const numberReg = /^([0-9]{1,}[.]?[0-9]*)$/
/* 整数 */
export const integerReg = /^\d+$/

export const bankRule = (msg) => ({
    pattern: bankReg,
    message: msg || "请输入正确的银行卡号",
    trigger: "blur",
});
/* 整数规则 */
export const integerRule = (msg) => ({
    pattern: integerReg,
    message: msg || "请输入整数",
    trigger: "blur",
});
/* 数字规则 */
export const numberRule = (msg) => ({
	pattern: numberReg,
	message: msg || "请输入数字",
	trigger: "blur",
});
// etc卡号
export const cardNumberRule = (msg) => ({
    pattern: /(^\d{12}$)|(^\d{16}$)/,
    message: msg || '请输入12或16位纯数字卡号',
    trigger: 'blur'
})
export const cardNumberRuleList = (msg) => ({
    pattern: /(^\d{12}$)|(^\d{16}$)|(^\d{20}$)/,
    message: msg || '请输入12,16或20位纯数字卡号',
    trigger: 'blur'
})

export const mobileRule = (msg) => ({
    pattern: mobileReg,
    message: msg || "请输入正确格式手机号",
    trigger: "blur",
});

export const idCardRule = (msg) => ({
    pattern: idCardReg,
    message: msg || "请输入正确格式身份证号码",
    trigger: "blur",
});

export const plateNumberRule = (msg) => ({
    pattern: plateNumberReg,
    message: msg || "请输入正确格式车牌号",
    trigger: "blur",
});

export const phoneRule = (msg) => ({
    validator: (rule, value, callback) => {
        if (!mobileReg.test(value) && !landPhoneReg.test(value)) {
            callback(new Error(msg || "请输入正确格式电话号码"));
            return;
        }
        callback();
    },
    trigger: "blur",
});
export const urlRuleList = (msg) => ({
    pattern:
        /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/,
    message: msg || "请输入正确的ulr地址",
    trigger: "blur",
});
